package commom.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class result<T> {
    private Integer code;
    private  String message;
    private T data;


    public static <T> result<T> success(T data){
        return new result<>(20000,"success",data);
    }
    public static <T> result<T> success(){
        return new result<>(20000,"success",null);
    }
    public static <T> result<T> success(T data,String message){
        return new result<>(20000,message,data);
    }
    public static <T> result<T> success(String message){
        return new result<>(20000,"success",null);
    }

    public static <T> result<T> fail(){
        return new result<>(20001,"fail",null);
    }
    public static <T> result<T> fail(Integer code){
        return new result<>(code,"fail",null);
    }
    public static <T> result<T> fail(Integer code,String message){
        return new result<>(code,message,null);
    }
    public static <T> result<T> fail(String message){
        return new result<>(20001,message,null);
    }
}
